Subject: STUN Operation in the Cisco Router

From: [email-masked]
Date: Mon, 12 Jul 93 14:42:39 PDT

Connect/Disconnect SIGlet members:

    I realize this SIGlet doesn't have an agreed-upon charter yet but I
    think some real-world examples of today's tunneling products can go
    a long way to help people think about the bounds of the charter.

    Attached below are 4 flow diagrams for cisco's SDLC-to-SDLC
    tunneling product named STUN (for Serial TUNneling).  I've provided
    them to start a discussion on:
        (1) how DLSw would handle bi-directional Normal Response Mode
            protocols,
        (2) how to support DLC protocols that don't have a built-in
            discovery protocol like LLC2 does,
        (3) whether NT 2.1 end stations can easily be accommodated in the
            current design of DLSw.

Regards,
-----------
Wayne Clark
cisco Systems, Inc.
[email-masked]
415/688-4627

P.S. Thanks go to Rick Konlon (cisco) for finding a way to generate
     ASCII stick-man diagrams from a "draw" package.

                   STUN Operation in the Cisco Router

                               12 Jul 93

    1.0 Introduction and Description of the Flow Diagrams
        -------------------------------------------------

        There are 4 flow diagrams that illustrate several sequences:
            (1) STUN Connection Sequence:  Normal Case
                (a) connection sequence,
                (b) I-Frame traffic sequence,
                (c) XID/TEST traffic sequence
            (2) STUN Disconnection Sequence:  Normal Case
                (a) primary-initiated disconnect
                (b) secondary-initiated disconnect
            (3) STUN Disconnection Sequence:  SDLC Link Outage
                (a) primary-side outage
                (b) secondary-side outage
            (4) STUN Disconnection Sequence:  TCP Session Loss

        Some things that need explaining:
            - routers are boxes with the cross in them (you can thank
              cisco marketing for the icon :-),
            - the labels directly beneath the routers (such as "Disconnected",
              "Active", "Await Linkdown UA") are state names for the STUN
              finite state machine
            - a "/" means "or". For instance "UA/DM" means that either UA or
              DM is acceptable.

        The flow diagrams show that Origin Station as the primary SDLC
        link station.  With XID3 negotiation, the link station role is
        determined by the end stations and either one could be the primary.

    2.0 Phases of STUN Processing
        -------------------------

        I've broken STUN up into 4 distinct phases of operation in attempt
        to compare and contrast it with DLSw.

    2.1 Pre-Connect Phase
        -----------------

        SDLC does not have a discovery mechanism like LLC2 so there must
        be some method of determining the whereabouts of the end stations.

        There are at least 2 ways tell routers where the pair of end stations
        are:
            (1) through static configuration, and
            (2) through assignment of a pseudo-MAC address to SDLC devices.

        Number (1) is the one used by STUN today.  Each router pair equates
        the term (SDLC address, STUN group) to a destination IP address on
        a router.  The IP address uniquely identifies the router, the STUN
        group identifies the particular interface, and the SDLC address 
        defines the secondary link station address.  Having the STUN group
        allows you to support duplicate SDLC addreses in a single router
        (for instance, if there are multiple 3274's with an SDLC address 
        of 0xC1).

            Pro: SDLC lines don't move around.
                 No overhead for router rendezvous.
            Con: Static configuration required (i.e. SDLC addr,IP addr).

        Number (2) is the one mentioned by Simon Graham of DEC (reference
        "How to support non-LAN DLCs", 7 Jul 93).  It is the alternative
        that is more DLSw-like.  The router that is attached to the primary
        SDLC would initiate the CANUREACH sequence and the appropriately
        configured router connected to the secondary SDLC would issue the
        ICANREACH reply.

            Pro: More conducive to today's DLSw design.
            Con: Static configuration required (i.e. Pseudo MAC,SAP).
                 Protocol overhead for router rendezvous.
                 Questions about scalability with multidrop secondary SDLC.
                     (The IBM DLSw development team should be able to
                     answer this one.)

        There are no flow diagrams below that pertain to the Pre-Connect
        Phase.

    2.2 Connect Phase
        -------------

        The Connect phase is concerned with establishing an end-to-end 
        connection between end stations.  The basic rule here is to
        let the router pair and the IP network appear to be a "wire"
        as much as possible and to let the end stations be the most
        important elements in the end-to-end dialogue.

            Pro: Minimal connect logic in the router.
                 No need to do RNR flow control to the end stations at startup.
            Con: Need to throttle SNRMs if there are end-to-end network
                 delays.

        Any XID3 traffic that is received by the router in the Connect phase
        is passed through to the partner router unaltered.  The router is
        a passive element in the negotiation.  This works fine for like
        media on each side of the tunnel.  If the media were different,
        the router would have to become an active element in the XID3
        negotiation.  As Shannon Nix of Netlink pointed out (reference
        "Re: IBM DLSw activity", 11 May 93), the manipulation would be:
            - ABM capable bit
            - Max frame size (MAXDATA)
            - Receive window size (MAXIN)
            - Link station role

        This phase is illustrated in "STUN Connection Sequence:  Normal Case".

    2.3 Data Transfer Phase
        -------------------

        After both routers in the pair reach Active state, all idle poll
        traffic is handled locally.  I-Frames are passed end to end and
        are subject to flow control constraints (not shown ... this is
        the subject of another SIGlet).  TEST and XID frames are also
        passed through end to end (e.g. non-negotiation XID3).

        This phase is illustrated in "STUN Connection Sequence:  Normal Case".

    2.4 Disconnect Phase
        ----------------

        Either the primary or the secondary link station can initiate
        the disconnect sequence.  There are both orderly and disorderly
        take-down sequences.

        Just like the Connect phase, an orderly Disconnect operation
        uses an end station-to-end station dialogue, keeping in mind
        the requirements of a Normal Response Mode protocol (i.e.
        Request Disconnect for secondary versus Disconnect for
        primary).

        The orderly take-down sequence is illustrated in "STUN Disconnection
        Sequence:  Normal Case".

            Pro: No NRM DLC protocol violation.
            Con: More states involved.

        When the disconnection is disorderly (i.e. an SDLC link is lost
        or the TCP/IP session is lost), as much of the orderly
        Disconnect operation is followed as possible.

        The disorderly take-down sequence is illustrated in "STUN 
        Disconnection Sequence:  SDLC Link Outage" and "STUN Disconnection
        Sequence:  TCP Session Loss".

    3.0 Summary
        -------

        cisco has installations of STUN in the following SDLC-to-SDLC
        environments:
          - PU 4 to PU 2
          - PU 4 to PU 4
          - NT 2.1 to NT 2.1

        Caveats:
          (1) STUN only supports leased line connections.  Switched lines
              are not supported.
          (2) Since there aren't as many SDLC sessions in a router as there 
              are potential LLC2 sessions, each pair of "adjacent" SDLC
              link stations uses a single TCP/IP session (also, 1
              TCP/IP session is used in the multidrop secondary SDLC
              case).  This is obviously different than DLSw.


STUN Connection Sequence:  Normal Case

   ======                            ___                           ======
   |    |        ---------        __/   \__       ---------        |    |
   |    |      __|  _|_  |__     /   IP    \    __|  _|_  |__      |    |
   ======        |   |   |      <  Network  >     |   |   |        ======
  /______\       ---------       \__     __/      ---------       /______\
                Origin STUN         \___/        Target STUN          
   Origin                                                          Target
   Station                                                        Station

                Disconnected                    Disconnected   
XID/TEST                       OP_PASS                         XID/TEST
----------->                   ------------>                   ----------->
                                                               
     XID/TEST                          OP_PASS                       XID/TEST
 <-----------                    <------------                   <-----------
                                                               
  (note 1)                                                     
     XID                           OP_PASS                          XID
<---------->                    <----------->                   <---------->
  (note 2)                                                     
                                                               
SNRM                           OP_LINKUP_REQ                   SNRM
----------->                   ------------>                   ----------->
(notes 3 & 4)   Await Linkup                     Await SDLC    
                  Response                          Open
                                                               
           UA                    OP_LINKUP_RSP                             UA
 <-----------                    <------------                   <-----------
                   Active                          Active      
                                                               
===========================================================================
                                                               
RR(P)                                                          RR(P)
----------->                                                   ----------->
                                                               
        RR(F)  (note 5)                               (note 5)          RR(F)
 <-----------                                                    <-----------
                                                               
RR(P)                                                          RR(P)
----------->                                                   ----------->
                                                               
        RR(F)                                                           RR(F)
 <-----------                                                    <-----------
                                                                             
   I-Frame                         OP_DATA                        I-Frame
<---------->                    <----------->                   <---------->
                                                                      
  XID/TEST                         OP_PASS                        XID/TEST
<---------->                    <----------->                   <---------->
                                  (note 1)                     

Notes:                                                    cisco Engineering
  1. XID and TEST are always passed through STUN              DLSw SIG
      unaltered.  They do not affect the STUN finite         09 July 93
      state machine.
  2. XID3 negotiation at this point is handled by the
      end systems and STUN does not play a role in the
      negotiation.
  3. The rate of absorption of SNRMs is adjustable.
      That is, only 1 SNRM is permitted through every
      'n' seconds.
  4. Either the Origin Station or the Target Station
      could become the primary SDLC link station.
  5. All Receiver Ready traffic is handled locally.


STUN Disconnection Sequence:  Normal Case

   ======                            ___                           ======
   |    |        ---------        __/   \__       ---------        |    |
   |    |      __|  _|_  |__     /   IP    \    __|  _|_  |__      |    |
   ======        |   |   |      <  Network  >     |   |   |        ======
  /______\       ---------       \__     __/      ---------       /______\
                Origin STUN         \___/        Target STUN          
   Origin                                                          Target
   Station                                                        Station

Primary-initiated                                              
Disconnection:

                   Active                          Active      
DISC                           OP_LINKDOWN_REQ                 DISC
----------->                   ------------>                   ----------->
               Await Linkdown                  Await Linkdown  
                  Response                           UA
           UA                  OP_LINKDOWN_RSP                          UA/DM
 <-----------                    <------------                   <-----------
                Disconnected                    Disconnected   
                                                               
===========================================================================
                                                               
Secondary-initiated                                            
Disconnection:

                   Active                          Active      
           RD                        OP_RD_REQ                             RD
 <-----------                    <------------                   <-----------
                Await Normal                   Await Linkdown  
                 Disconnect                        Request
                                                               
DISC                           OP_LINKDOWN_REQ                 DISC
----------->                   ------------>                   ----------->
               Await Linkdown                  Await Linkdown  
                  Response                           UA
           UA                  OP_LINKDOWN_RSP                          UA/DM
 <-----------                    <------------                   <-----------
                Disconnected                    Disconnected   
                                                               
===========================================================================

Notes:                                                    cisco Engineering
  1. None.                                                    DLSw SIG
                                                             09 July 93


STUN Disconnection Sequence:  SDLC Link Outage

   ======                            ___                           ======
   |    |        ---------        __/   \__       ---------        |    |
   |    |      __|  _|_  |__     /   IP    \    __|  _|_  |__      |    |
   ======        |   |   |      <  Network  >     |   |   |        ======
  /______\       ---------       \__     __/      ---------       /______\
                Origin STUN         \___/        Target STUN          
   Origin                                                          Target
   Station                                                        Station

  Case 1                                                       
Primary-side Outage:

                   Active                          Active      
 <SDLC LINE                                                    
    DROP>
                               OP_ABORT_REQ                    DISC
                               ------------>                   ----------->
                Await Abort                    Await Linkdown  
                  Response                           UA
                                                               
                                  OP_ABORT_RSP                          UA/DM
                                 <------------                   <-----------
                Disconnected                    Disconnected   
                                                               
===========================================================================
                                                               
  Case 2                                                       
Secondary-side Outage:

                   Active                          Active      
                                                                 <SDLC LINE
                                                                   DROP>
           RD                     OP_ABORT_REQ                 
 <-----------                    <------------                 
                Await Abend                      Await Abort   
                 Disconnect                       Response
                                                               
DISC                           OP_ABORT_RSP                                  
----------->                   ------------>                                 
                                                Disconnected   
           UA                                                  
 <-----------                                                  
                Disconnected                                   
                                                               
===========================================================================

Notes:                                                    cisco Engineering
  1. None.                                                    DLSw SIG
                                                             09 July 93


STUN Disconnection Sequence:  TCP Session Loss

   ======                            ___                           ======
   |    |        ---------        __/   \__       ---------        |    |
   |    |      __|  _|_  |__     /   IP    \    __|  _|_  |__      |    |
   ======        |   |   |      <  Network  >     |   |   |        ======
  /______\       ---------       \__     __/      ---------       /______\
                Origin STUN         \___/        Target STUN          
   Origin                                                          Target
   Station                                                        Station

                   Active                          Active      
                                     TCP                       
                                 SESSION LOSS
                                                               
           RD                                                  DISC
<------------                                                  ----------->
                                                               
DISC                                                                    UA/DM
----------->                                                     <-----------
                                                Disconnected   
           UA                                                  
 <-----------                                                  
                Disconnected                                   
                                                               
===========================================================================

Notes:                                                    cisco Engineering
  1. None.                                                    DLSw SIG
                                                             09 July 93